
 
package com.ruoyi.coin.enums;


import java.math.BigDecimal;

/**
 *  链路类型
 */
public enum OklinkChainEnum {

    /**
     * 参数解析
     * 参数一   链路符号（不可改）
     * 参数二   链路中文名称（不可改）
     * 参数三   购买金额（可改） 如果是币安链的话代币BNB，即0.001=0.001BNB  其他一样.ETH  BASE
     * 参数四   链路id(不可改)
     * 参数五   是否开启（可改） true=开启购买、卖出  false=不可购买、卖出
     * 参数六   目标价格比例（可改） ，即如果购买单价是 1 如果设置为1.3  则目标卖出的价格是1*1.3的时候才触发卖出
     * 参数七   滑点（可改） 0.1=10%
     * 参数八   合约地址（不可改）
     * 参数九   gas倍数（可改） 如果设置为3  则gas=gas*3
     * 参数十   K线小时数（可改） 如果设置8 则代币如果k线小时数小于8 ，则可以买入，否则不买入
     */
    BSC("bsc", "币安链",BigDecimal.valueOf(0.001),56,true,BigDecimal.valueOf(1.3),"0.1","0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",3,8),

    ETH("eth", "以太链",BigDecimal.valueOf(0.0005),1,true,BigDecimal.valueOf(1.3),"0.1","0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",1,8),
    BASE("base", "base",BigDecimal.valueOf(0.0005),8453,true,BigDecimal.valueOf(1.3),"0.1","0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",1,8)
    ;

    private final String code;//
    private final String name;

    private final Integer chainId;

    private final Boolean openFalg;

    private BigDecimal sellRatio;//卖出比例

    private String slippage;//滑点

    private BigDecimal buyAmount;

    private String contract;

    private Integer gas;

    private Integer kiline;

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public Integer getChainId() {
        return chainId;
    }

    public Boolean getOpenFalg() {
        return openFalg;
    }

    public BigDecimal getSellRatio() {
        return sellRatio;
    }

    public String getSlippage() {
        return slippage;
    }

    public BigDecimal getBuyAmount() {
        return buyAmount;
    }

    public String getContract() {
        return contract;
    }

    public Integer getGas() {
        return gas;
    }

    public Integer getKiline() {
        return kiline;
    }

    OklinkChainEnum(String code, String name, BigDecimal buyAmount, Integer chainId, boolean openFalg, BigDecimal sellRatio, String slippage, String contract, Integer gas,Integer kiline) {
        this.code = code;
        this.name = name;
        this.buyAmount =buyAmount;
        this.chainId = chainId;
        this.openFalg =openFalg;
        this.sellRatio =sellRatio;
        this.slippage = slippage;
        this.contract =contract;
        this.gas =gas;
        this.kiline =kiline;
    }

    public static OklinkChainEnum fromName(String name) {
        for (OklinkChainEnum type : OklinkChainEnum.values()) {
            if (type.name.equals(name)) {
                return type;
            }
        }
        return null;
    }

    public static OklinkChainEnum getByCode(String code) {
        for (OklinkChainEnum type : OklinkChainEnum.values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        return null;
    }

}
